package test;

public class test2 {

	public static void main(String[] args) {
		int num = 2000;
		int sum = 0;
		for(int i=2;i<num;i++) {
			boolean flag = true;
			for(int j=2;j<i;j++) {
				if(i%j==0)
					flag = false;
			}
			if(flag) {
				System.out.print(i+" ");
				sum++;
				if(sum==5) {
					sum = 0;
					System.out.print("\n");
				}
			}
		}
	}
}
